package com.example.bbgds.test;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

public class MainActivity extends Activity {

    private VerticalViewPager mVerticalViewPager;
    private List<View> mListViews;
    VoiceDragLayout layout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

//        setContentView(R.layout.activity_main2);
        setContentView(R.layout.activity_main);
//        LayoutTop top = (LayoutTop)findViewById(R.id.top);
//        top.setLayoutBottom((LayoutBottom)findViewById(R.id.bottom));
//        layout = (VoiceDragLayout)findViewById(R.id.viewpager);
//        layout.setFragmentManager(getFragmentManager());
        Intent itent = new Intent(this, RemoteService.class);
        startService(itent);
//        setContentView(new TestView(this));

//        setContentView(View.inflate(this,R.layout.layout1, null));
//        mVerticalViewPager = (VerticalViewPager)findViewById(R.id.viewpager);
//        View view1 = View.inflate(this,R.layout.layout1, null);
//        view1.setBackgroundColor(0xFFEE9A00);
//        View view2 = new View2(this);
//        view2.setBackgroundColor(0xFFFFFFFF);
//        View view3 = new View3(this);
//        view3.setBackgroundColor(0xFFFF3300);
//
//        mListViews = new ArrayList<View>();// 将要分页显示的View装入数组中
//        mListViews.add(view1);
//        mListViews.add(view2);
//        mListViews.add(view3);
//        mVerticalViewPager.setAdapter(new MyAdapter());

    }

    @Override
    public void onResume(){
        super.onResume();
    }


    @Override
    public void onPause(){
        super.onPause();
    }

    private class MyAdapter extends PagerAdapter {

        @Override
        public int getCount() {
            return mListViews.size();
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public void destroyItem(ViewGroup container, int position,
                                Object object) {
            container.removeView(mListViews.get(position));
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            container.addView(mListViews.get(position));
            return mListViews.get(position);
        }
    }
}
